// 体统一接口响应数据格式
const responseHandler = async (ctx, next) => {
    ctx.send = (data = null, code = 200, msg = "SUCCESS", error = null, serviceCode = 200) => {
        ctx.body = {
            data,// 响应数据
            msg,// 响应消息
            error,// 错误信息
            serviceCode,// 服务端状态码
        }
        ctx.status = code;
    }
    await next();
}
module.exports = responseHandler;
